import http from '@/utils/request'

/**
 * 获取元素树
 */
export const getElementsTree = (roleId) => {
  return http.get("/admin/element/getElementsTree", { roleId: roleId });
};

/**
 * 获取元素列表
 */
export const getElements = (params) => {
  return http.post("/admin/element/getElements", params);
};

/**
 * 添加元素
 */
export const addElement = (params) => {
  return http.post("/admin/element/insert", params);
};

/**
 * 修改元素
 */
export const updateElement = (params) => {
  return http.post("/admin/element/update", params);
};

/**
 * 删除元素
 */
export const deleteElement = (id) => {
  return http.delete("/admin/element/delete", { id: id });
};

/**
 * 根据id查询元素
 */
export const getElementById = (id) => {
  return http.get("/admin/element/selectById", { id: id });
};
